from subprocess import Popen,PIPE
from time import sleep
from fcntl import fcntl, F_GETFL, F_SETFL
from os import O_NONBLOCK, read

p = Popen(["linphonec","-b","mylinphonerc","-a"],
    stdin = PIPE,
    stdout = PIPE,
    stderr = PIPE,
    shell = False)
flags = fcntl(p.stdout,F_GETFL)
fcntl(p.stdout,F_SETFL,flags|O_NONBLOCK)

sleep(0.1)
while True:
    try:
        print read(p.stdout.fileno(),1024),
    except OSError:
	1==1